<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="/templates/home.xhtml" >
<ui:define name="corpo_home">
<h:body>
    <p:growl id="mensagens" globalOnly="true" />
    <p:tabView id="telaLogin" dynamic="true">
        <p:tab id="identificacaoUsuario" title="Login" > 
        <center>
            <h:outputText value="Usuário ou senha incorretos ou usuário inativo" rendered="#{param.erro}" style="color: darkred"/>
        </center>
        <form id="login" method="post" action="${request.contextPath}/j_spring_security_check" >
            <h:form prependId="false">
                <h:panelGrid columns="1" cellpadding="2" cellspacing="1">
                    <h:graphicImage library="imagens" name="logo.png" width="250" style="border:0;" />
                    <h:outputLabel value="Já sou usuário do SISPAC " style="font-weight: bold; font-size: 14px; color: darkblue;" />
                    <h:outputLabel value="Sistema Pagamento de Auxiliares Civis" style="font-weight: bold; font-size: 14px; color: darkblue;" />
                    <h:outputLabel for="j_username" value="Usuário:  " /> 
                    <h:inputText id="j_username" required="true" size="30"/>
                    <h:outputLabel for="j_password" value="Senha:   " />
                    <h:inputSecret id="j_password" required="true" size="30"/>
                    <br />
                    <p:commandButton value="ACESSAR" ajax="false" immediate="true"/>
                    <script>
                        document.getElementById("login").j_username.value = "#{SPRING_SECURITY_LAST_USERNAME}";
                    </script>
                </h:panelGrid>
            </h:form>
        </form>
        </p:tab>  
        <p:tab title="Esqueci a senha" >
        <p:fieldset>
        <h:form id="painelEsqueceuSenha">
            <h:messages style="color: red" />
            <h:panelGrid id="painel">  
                <h:outputLabel value="Saram:" for="saram" />
                <h:inputText id="saram" value="#{enviaEmailBean.saramDestinatario}" required="true" size="30" requiredMessage="Campo Saram obrigatório!" maxlength="8" />
                <h:outputLabel for="informeEmail" value="Email funcional (intraer):"/>
                <h:inputText id="informeEmail" value="#{enviaEmailBean.emailDestinatario}" size="30" maxlength="255" required="true" requiredMessage="Campo email obrigatório!" validatorMessage="E-mail inválido!" >
                    <f:validateRegex pattern="[a-zA-Z0-9\-\_\.]+@[a-zA-Z0-9\-\_\.]+" />
                </h:inputText>
                <br />
                <p:commandButton value="Enviar" actionListener="#{enviaEmailBean.enviaEmailRecuperacao}" update="painelEsqueceuSenha, emailMessage, saramMessage, mensagens" image="ui-icon ui-icon-mail-closed" ajax="true" >
                    <f:setPropertyActionListener target="#{enviaEmailBean.saramDestinatario}" value="#{enviaEmailBean.saramDestinatario}" />
                    <f:setPropertyActionListener target="#{enviaEmailBean.emailDestinatario}" value="#{enviaEmailBean.emailDestinatario}" />
                </p:commandButton>
                <br />
            </h:panelGrid> 
        </h:form>
        </p:fieldset>
        </p:tab>
    </p:tabView>
    <p:tabView id="telaNovoCadastro">
        <p:tab id="novoCadastro" title="Cadastre-se" > 
            <h:form>
                <h:panelGrid>
                    <h:outputLabel value="Este é seu primeiro acesso no SISPAC - Sistema de Pagamento de Auxiliares Civis? Cadastre-se aqui." style="color: darkblue" />
                    <br />
                    <h:panelGroup>
                        <center>
                            <h:graphicImage library="imagens" name="logo_spp_73_Anos.png" width="90"  style=" border:0; display: block" />
                        </center>
                    </h:panelGroup>
                    <br />
                    <br />
                    <p:commandButton value="INICIAR CADASTRO" actionListener="#{cadastroUsuarioBean.prepararAdicionarUsuario(actionEvent)}" action="#{cadastroUsuarioBean.novo()}" immediate="true" ajax="false" />
                    <br />
                </h:panelGrid>
            </h:form>
        </p:tab>
    </p:tabView>
    <p:tabView id="telaSlides">
        <p:tab id="slides" title="Assessoria de Controle Interno" >
            <h:form id="imagensZoom" prependId="false" style="background-color: white" >
                <p:fieldset>
                <center>
                <p:imageSwitch effect="turnDown" >  
                    <ui:repeat value="#{imagemSwitchBean.imagens}" var="imagem">  
                        <h:graphicImage library="imagens" name="#{imagem}" height="260px" width="505px" style="padding-top: 3px"/>
                    </ui:repeat>  
                </p:imageSwitch> 
                </center>
                </p:fieldset>
            </h:form>
        </p:tab>
    </p:tabView>
</h:body>
</ui:define>
</ui:composition>
</html>
